05. 解决方案:你的首个 JOIN

解决方案

1.

SELECT orders.*, accounts.*
FROM accounts
JOIN orders
ON accounts.id = orders.account_id;

注意,上述结果与你切换 FROM JOIN 中的表格得到的结果一样。此外, = 两边的列顺序并不重要。

2.

SELECT orders.standard_qty, orders.gloss_qty,
orders.poster_qty,  accounts.website,
accounts.primary_poc
FROM orders
JOIN accounts
ON orders.account_id = accounts.id

注意,我们需要在 SELECT 语句中指定某列所来自的每个表格。